package com.handu.luna.core.domain.user;

import javax.persistence.Entity;
import javax.persistence.Transient;
import javax.validation.constraints.Size;

import com.handu.luna.core.domain.BasePersistentDomain;

@Entity
public class UserLog extends BasePersistentDomain<UserLogRepository>{
	
	public enum LevelPointStatus{
		INCREASE("+"),REDUCE("-");
		public String description;	    
		LevelPointStatus(final String description) {
	        this.description = description;
	    }
	}
	public enum ConsumePointStatus{
		INCREASE("+"),REDUCE("-");
		public String description;	    
		ConsumePointStatus(final String description) {
	        this.description = description;
	    }
	}
	private long userId;
	@Size(min=1,max=200, message="变动原因不能为空或超过200个字符。")
	private String logRemark; //帐户变动原因
	private int logLevelPoint; //等级积分变动
	private int logConsumePoint; //消费积分变动
	private LevelPointStatus levelPointStatus; //等级积分变动状态
	private ConsumePointStatus consumePointStatus;//消费积分变动状态
	
	@Transient
	private User user;
	
	
	
	public User getUser() {
		if(this.userId != 0 && user == null){
			user = context.getUserRepository().findOne(this.userId);
		}
		return user;
	}
	public void setUser(User user) {
		this.user = user;
	}
	public long getUserId() {
		return userId;
	}
	public void setUserId(long userId) {
		this.userId = userId;
	}
	public String getLogRemark() {
		return logRemark;
	}
	public void setLogRemark(String logRemark) {
		this.logRemark = logRemark;
	}
	public int getLogLevelPoint() {
		return logLevelPoint;
	}
	public void setLogLevelPoint(int logLevelPoint) {
		this.logLevelPoint = logLevelPoint;
	}
	public int getLogConsumePoint() {
		return logConsumePoint;
	}
	public void setLogConsumePoint(int logConsumePoint) {
		this.logConsumePoint = logConsumePoint;
	}
	public LevelPointStatus getLevelPointStatus() {
		return levelPointStatus;
	}
	public void setLevelPointStatus(LevelPointStatus levelPointStatus) {
		this.levelPointStatus = levelPointStatus;
	}
	public ConsumePointStatus getConsumePointStatus() {
		return consumePointStatus;
	}
	public void setConsumePointStatus(ConsumePointStatus consumePointStatus) {
		this.consumePointStatus = consumePointStatus;
	}

	
}
